/*
 * @Author: xiaxia
 * @Description: 
 * @Date: 2024-07-09 17:27:30
 * @LastEditTime: 2024-07-10 10:41:25
 * @FilePath: \project\src\api\acl\permission\index.ts
 */
import request from "@/utils/request";
import { MenuInfo, PermissionInfo, PermissionResponse } from "./type";

enum API {
  GETPERMISSION_URL = '/admin/acl/permission', // 获取菜单list
  ADDPERMISSION_URL = '/admin/acl/permission/save', // 添加菜单
  EDITPERMISSION_URL = '/admin/acl/permission/update', // 编辑菜单
  DELETEERMISSION_URL = '/admin/acl/permission/remove/', // 删除菜单
}

export const reqGetPermission = ()=> request.get<any,PermissionResponse>(API.GETPERMISSION_URL)
// 编辑和添加菜单
export const reqAddEditPer = (data:MenuInfo) => {
  if(data.id) {
    return request.put<any, any>(API.EDITPERMISSION_URL,data)
  } else {
    return request.post<any, any>(API.ADDPERMISSION_URL,data)
  }
}
export const reqDelPermission = (id:number)=> request.delete<any,any>(API.DELETEERMISSION_URL+id)